import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import fastclick from 'fastclick'
import VueMeta from 'vue-meta'
import axios from 'axios'
import NProgress from 'nprogress'
import './assets/font/iconfont.css'
import './assets/css/global.scss'
import 'swiper/dist/css/swiper.min.css'
import 'nprogress/nprogress.css'

// 请求根路径
axios.defaults.baseURL = 'http://127.0.0.1:7001/'
// 在request中展示进度条
axios.interceptors.request.use(config => {
  NProgress.start()
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})
// 在response 拦截器中隐藏进度条
axios.interceptors.response.use(config => {
  NProgress.done()
  return config
})

Vue.config.productionTip = false
fastclick.attach(document.body)
Vue.prototype.$axios = axios

Vue.use(VueAwesomeSwiper)
Vue.use(VueMeta)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
